import scrapy


class QidianSpider(scrapy.Spider):
    name = 'qidian'
    allowed_domains = ['qidian.com']
    start_urls = ['https://www.qidian.com/rank/fengyun']

    def parse(self, response):
        names = response.xpath("//div[@class='book-mid-info']/h4/a/text()").extract()
        authors = response.xpath("//div[@class='book-mid-info']/p[@class='author']/a[1]/text()").extract()
        book = []
        for name, author in zip(names, authors):
            book.append({"name": name, "author": author})
        return book
